package com.bz.backend.item.feign.fallback;

import com.bz.backend.item.feign.CommonItemFeignClient;
import com.bz.pojo.TbItem;
import com.bz.pojo.TbItemCat;
import com.bz.pojo.TbItemDesc;
import com.bz.pojo.TbItemParam;
import com.bz.pojo.TbItemParamItem;
import com.bz.utils.PageResult;
import com.bz.vo.ItemVo;
import feign.hystrix.FallbackFactory;

import java.util.List;

/**
 * CommonItem 服务器 - openfeign 降级处理
 * 注意：实现服务降级后，db操作失败，将不会抛出异常，也就是说不会抛出异常，事务就不会生效，这时候可以手动判断抛出异常
 */
public class CommonItemFeignClientFallbackFactory implements FallbackFactory<CommonItemFeignClient> {

    @Override
    public CommonItemFeignClient create(Throwable throwable) {
        return new CommonItemFeignClient() {
            @Override
            public PageResult selectTbItemAllByPage(Integer page, Integer rows) {
                return null;
            }

            @Override
            public Integer insertTbItem(TbItem tbItem) {
                return null;
            }

            @Override
            public Integer deleteItemById(TbItem tbItem) {
                return null;
            }

            @Override
            public ItemVo preUpdateItem(Long itemId) {
                return null;
            }

            @Override
            public Integer updateItem(TbItem tbItem) {
                return null;
            }

            @Override
            public List<TbItemCat> selectItemCategoryByParentId(Long id) {
                return null;
            }

            @Override
            public TbItemParam selectItemParamByItemCatId(Long itemCatId) {
                return null;
            }

            @Override
            public PageResult selectItemParamAll(Integer page, Integer rows) {
                return null;
            }

            @Override
            public Integer insertItemParam(TbItemParam tbItemParam) {
                return null;
            }

            @Override
            public Integer deleteItemParamById(Long id) {
                return null;
            }

            @Override
            public Integer insertItemDesc(TbItemDesc tbItemDesc) {
                return null;
            }

            @Override
            public Integer updateItemDesc(TbItemDesc tbItemDesc) {
                return null;
            }

            @Override
            public Integer insertTbItemParamItem(TbItemParamItem tbItemParamItem) {
                return null;
            }

            @Override
            public Integer updateTbItemParamItem(TbItemParamItem tbItemParamItem) {
                return null;
            }
        };
    }
}
